package com.learning.batterySwapPro.common.response;

/**
 * @author wangyunyun
 */

public enum ResultCode {
	/* 成功状态码 */
	SUCCESS(200, "操作成功"),

	/* 客户端错误 4xx */
	BAD_REQUEST(400, "请求参数错误"),
	UNAUTHORIZED(401, "未授权访问"),
	FORBIDDEN(403, "禁止访问"),
	NOT_FOUND(404, "资源不存在"),
	CONCURRENCY_CONFLICT(40901, "并发冲突异常"),

	/* 服务端错误 5xx */
	INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
	SERVICE_UNAVAILABLE(503, "服务不可用"),

	/* 换电业务错误 6xxxx */
	// 电池相关
	BATTERY_NOT_AVAILABLE(60001, "电池库存不足"),
	BATTERY_STATUS_INVALID(60002, "电池状态无效"),

	// 换电站相关
	STATION_CLOSED(60101, "换电站暂停服务"),
	STATION_FULL(60102, "换电站仓位已满"),

	// 用户相关
	USER_BALANCE_INSUFFICIENT(60201, "用户余额不足"),
	USER_SUBSCRIPTION_EXPIRED(60202, "用户套餐已过期"),

	// 订单相关
	ORDER_ALREADY_PROCESSING(60301, "订单正在处理中"),
	ORDER_CANNOT_CANCEL(60302, "订单无法取消"),

	// 系统配置
	CONFIG_MISSING(60401, "系统配置缺失"),

	;

	private final int code;
	private final String message;

	ResultCode(int code, String message) {
		this.code = code;
		this.message = message;
	}

	public int getCode() {
		return code;
	}

	public String getMessage() {
		return message;
	}
}
